import { createApp } from 'vue'
import dialog from './dialog.vue'
import store from '@/store'

interface Option {
  title?: string;
  content?: string;
  confirmBtn?: boolean;
  submit?: Function;
  close?: Function;
  alertText?: string;
}

function SDialog(option = {} as Option) {
  const dom = document.createElement('div')
  document.body.appendChild(dom)
  const app = createApp(dialog, {
    close: () => {
      app.unmount();
      document.body.removeChild(dom);
    },
    ...option
  })
  app.mount(dom)
}
export default SDialog
